home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / include / pango-1.0 / pango / pango-font.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-04-25  |  13.8 KB  |  365 lines

  1. /* Pango
  2.  * pango-font.h: Font handling
  3.  *
  4.  * Copyright (C) 2000 Red Hat Software
  5.  *
  6.  * This library is free software; you can redistribute it and/or
  7.  * modify it under the terms of the GNU Library General Public
  8.  * License as published by the Free Software Foundation; either
  9.  * version 2 of the License, or (at your option) any later version.
  10.  *
  11.  * This library is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.     See the GNU
  14.  * Library General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU Library General Public
  17.  * License along with this library; if not, write to the
  18.  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  19.  * Boston, MA 02111-1307, USA.
  20.  */
  21.  
  22. #ifndef __PANGO_FONT_H__
  23. #define __PANGO_FONT_H__
  24.  
  25. #include <pango/pango-coverage.h>
  26. #include <pango/pango-types.h>
  27.  
  28. #include <glib-object.h>
  29.  
  30. G_BEGIN_DECLS
  31.  
  32. typedef struct _PangoFontDescription PangoFontDescription;
  33. typedef struct _PangoFontMetrics PangoFontMetrics;
  34.  
  35. /**
  36.  * PangoStyle:
  37.  * @PANGO_STYLE_NORMAL: the font is upright.
  38.  * @PANGO_STYLE_OBLIQUE: the font is slanted, but in a roman style.
  39.  * @PANGO_STYLE_ITALIC: the font is slanted in an italic style.
  40.  *
  41.  * An enumeration specifying the various slant styles possible for a font.
  42.  **/
  43. typedef enum {
  44.   PANGO_STYLE_NORMAL,
  45.   PANGO_STYLE_OBLIQUE,
  46.   PANGO_STYLE_ITALIC
  47. } PangoStyle;
  48.  
  49. typedef enum {
  50.   PANGO_VARIANT_NORMAL,
  51.   PANGO_VARIANT_SMALL_CAPS
  52. } PangoVariant;
  53.  
  54. typedef enum {
  55.   PANGO_WEIGHT_ULTRALIGHT = 200,
  56.   PANGO_WEIGHT_LIGHT = 300,
  57.   PANGO_WEIGHT_NORMAL = 400,
  58.   PANGO_WEIGHT_SEMIBOLD = 600,
  59.   PANGO_WEIGHT_BOLD = 700,
  60.   PANGO_WEIGHT_ULTRABOLD = 800,
  61.   PANGO_WEIGHT_HEAVY = 900
  62. } PangoWeight;
  63.  
  64. typedef enum {
  65.   PANGO_STRETCH_ULTRA_CONDENSED,
  66.   PANGO_STRETCH_EXTRA_CONDENSED,
  67.   PANGO_STRETCH_CONDENSED,
  68.   PANGO_STRETCH_SEMI_CONDENSED,
  69.   PANGO_STRETCH_NORMAL,
  70.   PANGO_STRETCH_SEMI_EXPANDED,
  71.   PANGO_STRETCH_EXPANDED,
  72.   PANGO_STRETCH_EXTRA_EXPANDED,
  73.   PANGO_STRETCH_ULTRA_EXPANDED
  74. } PangoStretch;
  75.  
  76. typedef enum {
  77.   PANGO_FONT_MASK_FAMILY  = 1 << 0,
  78.   PANGO_FONT_MASK_STYLE   = 1 << 1,
  79.   PANGO_FONT_MASK_VARIANT = 1 << 2,
  80.   PANGO_FONT_MASK_WEIGHT  = 1 << 3,
  81.   PANGO_FONT_MASK_STRETCH = 1 << 4,
  82.   PANGO_FONT_MASK_SIZE    = 1 << 5
  83. } PangoFontMask;
  84.  
  85. /* CSS scale factors (1.2 factor between each size) */
  86. #define PANGO_SCALE_XX_SMALL ((double)0.5787037037037)
  87. #define PANGO_SCALE_X_SMALL  ((double)0.6444444444444)
  88. #define PANGO_SCALE_SMALL    ((double)0.8333333333333)
  89. #define PANGO_SCALE_MEDIUM   ((double)1.0)
  90. #define PANGO_SCALE_LARGE    ((double)1.2)
  91. #define PANGO_SCALE_X_LARGE  ((double)1.4399999999999)
  92. #define PANGO_SCALE_XX_LARGE ((double)1.728)
  93.  
  94. /*
  95.  * PangoFontDescription
  96.  */
  97.  
  98. #define PANGO_TYPE_FONT_DESCRIPTION (pango_font_description_get_type ())
  99.  
  100. GType                 pango_font_description_get_type    (void);
  101. PangoFontDescription *pango_font_description_new         (void);
  102. PangoFontDescription *pango_font_description_copy        (const PangoFontDescription  *desc);
  103. PangoFontDescription *pango_font_description_copy_static (const PangoFontDescription  *desc);
  104. guint                 pango_font_description_hash        (const PangoFontDescription  *desc);
  105. gboolean              pango_font_description_equal       (const PangoFontDescription  *desc1,
  106.                               const PangoFontDescription  *desc2);
  107. void                  pango_font_description_free        (PangoFontDescription        *desc);
  108. void                  pango_font_descriptions_free       (PangoFontDescription       **descs,
  109.                               int                          n_descs);
  110.  
  111. void                 pango_font_description_set_family        (PangoFontDescription *desc,
  112.                                    const char           *family);
  113. void                 pango_font_description_set_family_static (PangoFontDescription *desc,
  114.                                    const char           *family);
  115. G_CONST_RETURN char *pango_font_description_get_family        (const PangoFontDescription *desc);
  116. void                 pango_font_description_set_style         (PangoFontDescription *desc,
  117.                                    PangoStyle            style);
  118. PangoStyle           pango_font_description_get_style         (const PangoFontDescription *desc);
  119. void                 pango_font_description_set_variant       (PangoFontDescription *desc,
  120.                                    PangoVariant          variant);
  121. PangoVariant         pango_font_description_get_variant       (const PangoFontDescription *desc);
  122. void                 pango_font_description_set_weight        (PangoFontDescription *desc,
  123.                                    PangoWeight           weight);
  124. PangoWeight          pango_font_description_get_weight        (const PangoFontDescription *desc);
  125. void                 pango_font_description_set_stretch       (PangoFontDescription *desc,
  126.                                    PangoStretch          stretch);
  127. PangoStretch         pango_font_description_get_stretch       (const PangoFontDescription *desc);
  128. void                 pango_font_description_set_size          (PangoFontDescription *desc,
  129.                                    gint                  size);
  130. gint                 pango_font_description_get_size          (const PangoFontDescription *desc);
  131. void                 pango_font_description_set_absolute_size (PangoFontDescription *desc,
  132.                                    double                size);
  133. gboolean             pango_font_description_get_size_is_absolute (const PangoFontDescription *desc);
  134.  
  135. PangoFontMask pango_font_description_get_set_fields (const PangoFontDescription *desc);
  136. void          pango_font_description_unset_fields   (PangoFontDescription       *desc,
  137.                              PangoFontMask               to_unset);
  138.  
  139. void pango_font_description_merge        (PangoFontDescription       *desc,
  140.                       const PangoFontDescription *desc_to_merge,
  141.                       gboolean                    replace_existing);
  142. void pango_font_description_merge_static (PangoFontDescription       *desc,
  143.                       const PangoFontDescription *desc_to_merge,
  144.                       gboolean                    replace_existing);
  145.  
  146. gboolean pango_font_description_better_match (const PangoFontDescription *desc,
  147.                           const PangoFontDescription *old_match,
  148.                           const PangoFontDescription *new_match);
  149.  
  150. PangoFontDescription *pango_font_description_from_string (const char                  *str);
  151. char *                pango_font_description_to_string   (const PangoFontDescription  *desc);
  152. char *                pango_font_description_to_filename (const PangoFontDescription  *desc);
  153.  
  154. /*
  155.  * PangoFontMetrics
  156.  */
  157.  
  158. #define PANGO_TYPE_FONT_METRICS  (pango_font_metrics_get_type ())
  159. GType             pango_font_metrics_get_type                    (void);
  160. PangoFontMetrics *pango_font_metrics_ref                         (PangoFontMetrics *metrics);
  161. void              pango_font_metrics_unref                       (PangoFontMetrics *metrics);
  162. int               pango_font_metrics_get_ascent                  (PangoFontMetrics *metrics);
  163. int               pango_font_metrics_get_descent                 (PangoFontMetrics *metrics);
  164. int               pango_font_metrics_get_approximate_char_width  (PangoFontMetrics *metrics);
  165. int               pango_font_metrics_get_approximate_digit_width (PangoFontMetrics *metrics);
  166. int               pango_font_metrics_get_underline_position      (PangoFontMetrics *metrics);
  167. int               pango_font_metrics_get_underline_thickness     (PangoFontMetrics *metrics);
  168. int               pango_font_metrics_get_strikethrough_position  (PangoFontMetrics *metrics);
  169. int               pango_font_metrics_get_strikethrough_thickness (PangoFontMetrics *metrics);
  170.  
  171. #ifdef PANGO_ENABLE_BACKEND
  172.  
  173. PangoFontMetrics *pango_font_metrics_new (void);
  174.  
  175. struct _PangoFontMetrics
  176. {
  177.   guint ref_count;
  178.   
  179.   int ascent;
  180.   int descent;
  181.   int approximate_char_width;
  182.   int approximate_digit_width;
  183.   int underline_position;
  184.   int underline_thickness;
  185.   int strikethrough_position;
  186.   int strikethrough_thickness;
  187. };
  188.  
  189. #endif /* PANGO_ENABLE_BACKEND */
  190.  
  191. /*
  192.  * PangoFontFamily
  193.  */
  194.  
  195. #define PANGO_TYPE_FONT_FAMILY              (pango_font_family_get_type ())
  196. #define PANGO_FONT_FAMILY(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_FONT_FAMILY, PangoFontFamily))
  197. #define PANGO_IS_FONT_FAMILY(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_FONT_FAMILY))
  198.  
  199. typedef struct _PangoFontFamily      PangoFontFamily;
  200. typedef struct _PangoFontFace        PangoFontFace;
  201.  
  202. GType      pango_font_family_get_type       (void) G_GNUC_CONST;
  203.  
  204. void                 pango_font_family_list_faces (PangoFontFamily  *family,
  205.                            PangoFontFace  ***faces,
  206.                            int              *n_faces);
  207. G_CONST_RETURN char *pango_font_family_get_name   (PangoFontFamily  *family);
  208. gboolean   pango_font_family_is_monospace         (PangoFontFamily  *family);
  209.  
  210. #ifdef PANGO_ENABLE_BACKEND
  211.  
  212. #define PANGO_FONT_FAMILY_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_FONT_FAMILY, PangoFontFamilyClass))
  213. #define PANGO_IS_FONT_FAMILY_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_FONT_FAMILY))
  214. #define PANGO_FONT_FAMILY_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_FONT_FAMILY, PangoFontFamilyClass))
  215.  
  216. typedef struct _PangoFontFamilyClass PangoFontFamilyClass;
  217.  
  218. struct _PangoFontFamily
  219. {
  220.   GObject parent_instance;
  221. };
  222.  
  223. struct _PangoFontFamilyClass
  224. {
  225.   GObjectClass parent_class;
  226.  
  227.   /*< public >*/
  228.   
  229.   void  (*list_faces)      (PangoFontFamily  *family,
  230.                     PangoFontFace  ***faces,
  231.                     int              *n_faces);
  232.   const char * (*get_name) (PangoFontFamily  *family);
  233.   gboolean (*is_monospace) (PangoFontFamily *family);
  234.  
  235.   /*< private >*/
  236.  
  237.   /* Padding for future expansion */
  238.   void (*_pango_reserved2) (void);
  239.   void (*_pango_reserved3) (void);
  240.   void (*_pango_reserved4) (void);
  241. };
  242.  
  243. #endif /* PANGO_ENABLE_BACKEND */
  244.  
  245. /*
  246.  * PangoFontFace
  247.  */
  248.  
  249. #define PANGO_TYPE_FONT_FACE              (pango_font_face_get_type ())
  250. #define PANGO_FONT_FACE(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_FONT_FACE, PangoFontFace))
  251. #define PANGO_IS_FONT_FACE(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_FONT_FACE))
  252.  
  253. GType      pango_font_face_get_type       (void) G_GNUC_CONST;
  254.  
  255. PangoFontDescription *pango_font_face_describe       (PangoFontFace *face);
  256. G_CONST_RETURN char  *pango_font_face_get_face_name (PangoFontFace *face);
  257. void                  pango_font_face_list_sizes     (PangoFontFace  *face, 
  258.                                                       int           **sizes, 
  259.                                                       int            *n_sizes);
  260.  
  261. #ifdef PANGO_ENABLE_BACKEND
  262.  
  263. #define PANGO_FONT_FACE_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_FONT_FACE, PangoFontFaceClass))
  264. #define PANGO_IS_FONT_FACE_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_FONT_FACE))
  265. #define PANGO_FONT_FACE_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_FONT_FACE, PangoFontFaceClass))
  266.  
  267. typedef struct _PangoFontFaceClass   PangoFontFaceClass;
  268.  
  269. struct _PangoFontFace
  270. {
  271.   GObject parent_instance;
  272. };
  273.  
  274. struct _PangoFontFaceClass
  275. {
  276.   GObjectClass parent_class;
  277.  
  278.   /*< public >*/
  279.   
  280.   const char           * (*get_face_name) (PangoFontFace *face);
  281.   PangoFontDescription * (*describe)       (PangoFontFace *face);
  282.   void                   (*list_sizes)     (PangoFontFace  *face, 
  283.                                             int           **sizes, 
  284.                                             int            *n_sizes);
  285.  
  286.   /*< private >*/
  287.  
  288.   /* Padding for future expansion */
  289.   void (*_pango_reserved2) (void);
  290.   void (*_pango_reserved3) (void);
  291.   void (*_pango_reserved4) (void);
  292. };
  293.  
  294. #endif /* PANGO_ENABLE_BACKEND */
  295.  
  296. /*
  297.  * PangoFont
  298.  */
  299.  
  300. #define PANGO_TYPE_FONT              (pango_font_get_type ())
  301. #define PANGO_FONT(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_FONT, PangoFont))
  302. #define PANGO_IS_FONT(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_FONT))
  303.  
  304. GType                 pango_font_get_type          (void) G_GNUC_CONST;
  305.  
  306. PangoFontDescription *pango_font_describe          (PangoFont        *font);
  307. PangoCoverage *       pango_font_get_coverage      (PangoFont        *font,
  308.                             PangoLanguage    *language);
  309. PangoEngineShape *    pango_font_find_shaper       (PangoFont        *font,
  310.                             PangoLanguage    *language,
  311.                             guint32           ch);
  312. PangoFontMetrics *    pango_font_get_metrics       (PangoFont        *font,
  313.                             PangoLanguage    *language);
  314. void                  pango_font_get_glyph_extents (PangoFont        *font,
  315.                             PangoGlyph        glyph,
  316.                             PangoRectangle   *ink_rect,
  317.                             PangoRectangle   *logical_rect);
  318. PangoFontMap         *pango_font_get_font_map      (PangoFont        *font);
  319.  
  320. #ifdef PANGO_ENABLE_BACKEND
  321.  
  322. #define PANGO_FONT_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_FONT, PangoFontClass))
  323. #define PANGO_IS_FONT_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_FONT))
  324. #define PANGO_FONT_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_FONT, PangoFontClass))
  325.  
  326. typedef struct _PangoFontClass       PangoFontClass;
  327.  
  328. struct _PangoFont
  329. {
  330.   GObject parent_instance;
  331. };
  332.  
  333. struct _PangoFontClass
  334. {
  335.   GObjectClass parent_class;
  336.  
  337.   /*< public >*/
  338.   
  339.   PangoFontDescription *(*describe)           (PangoFont      *font);
  340.   PangoCoverage *       (*get_coverage)       (PangoFont      *font,
  341.                            PangoLanguage  *lang);
  342.   PangoEngineShape *    (*find_shaper)        (PangoFont      *font,
  343.                            PangoLanguage  *lang,
  344.                            guint32         ch);
  345.   void                  (*get_glyph_extents)  (PangoFont      *font,
  346.                            PangoGlyph      glyph,
  347.                            PangoRectangle *ink_rect,
  348.                            PangoRectangle *logical_rect);
  349.   PangoFontMetrics *    (*get_metrics)        (PangoFont      *font,
  350.                            PangoLanguage  *language);
  351.   PangoFontMap *        (*get_font_map)       (PangoFont      *font);
  352.   /*< private >*/
  353.  
  354.   /* Padding for future expansion */
  355.   void (*_pango_reserved1) (void);
  356.   void (*_pango_reserved2) (void);
  357.   void (*_pango_reserved3) (void);
  358. };
  359.  
  360. #endif /* PANGO_ENABLE_BACKEND */
  361.  
  362. G_END_DECLS
  363.  
  364. #endif /* __PANGO_FONT_H__ */
  365.